<?php
/**
 * Created by PhpStorm.
 * File name: DistributionLog.php
 * User: Ym
 * Date: 2023/2/19
 * Time: 17:44
 */

namespace app\distribution\controller\sys_admin;

use app\AdminController;

class DistributionLog extends AdminController
{

    //*------------------------------------------------------ */
    //-- 初始化
    /*------------------------------------------------------ */
    public function initialize()
    {
        parent::initialize();
        $this->Model = new \app\distribution\model\DistributionLog();
    }

    //*------------------------------------------------------ */
    //-- 首页
    /*------------------------------------------------------ */
    public function index()
    {
        $this->getList(true);
        return $this->fetch('index');
    }
    /*------------------------------------------------------ */
    //-- 获取列表
    //-- $runData boolean 是否返回模板
    /*------------------------------------------------------ */
    public function getList($runData = false, $is_cancel = false)
    {

        $jc_id = input('jc_id');
        $viewObj = $this->Model->alias('dis_log')
            ->join('users u', 'u.user_id=dis_log.user_id')
            ->field('dis_log.*,u.nick_name')
            ->where("dis_log.jc_id", '=', $jc_id);
            //->where("dis_log.stage", '=', date('Ym'));

        $data = $this->getPageList($this->Model, $viewObj);
        $this->assign("data", $data);
        //$this->assign("search", $search);
        if ($runData == false) {
            $data['content'] = $this->fetch('list')->getContent();
            unset($data['list']);
            return $this->success('', '', $data);
        }
        return true;
    }
}